import { get, post } from '@/utils/request'
import type { UserLogin, UserRegister, UserResponse } from '@interface'

// 登陆
export const login = (param: UserLogin) => {
  return post<UserResponse>('/user/login', param)
}

// 注册
export const register = (param: UserRegister) => {
  return post<UserResponse>('/user/register', param)
}

// 查询用户列表
export const queryUsers = () => {
  return get<UserResponse[]>('/user/query')
}

// 获取用户详情信息
export const getUserDetail = (param: { id: number }) => {
  return get<UserResponse>('/user/detail', param)
}

// 更新用户详情信息
export const updateDetails = (param: Partial<UserResponse>) => {
  return post('/user/update', param)
}

/**
 * 上传用户头像(弃用)
 */
export const upload = (param: any) => {
  return post('/user/upload', param)
}
